package com.itheima.producer;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.Date;

@SpringBootTest
@RunWith(SpringRunner.class)
public class Producer_rabbit {
    @Autowired
    RabbitTemplate rabbitTemplate;
    @Test
    public void sendmessage(){
        String msg="发送短消息服务"+new Date();
        rabbitTemplate.convertAndSend(ProducerConfig.EXCHANGE_RAABIT,ProducerConfig.ROUTE_SMS,msg);
    }
    @Test
    public void sendEmail(){
        String msg="发送邮箱消息服务HHHHH"+new Date();
        rabbitTemplate.convertAndSend(ProducerConfig.EXCHANGE_RAABIT,ProducerConfig.ROUTE_EMAIL,msg);
    }
}
